let t = require;
let  e = module
let  o =  e.exports;
 o.default =  e.exports;

                'use strict';
                console.log("start");
                var _n39,
                    i =
                    (this && this.__extends) ||
                    ((_n39 = function n(t, e) {
                            return (_n39 =
                                Object.setPrototypeOf ||
                                ({
                                        __proto__: []
                                    }
                                    instanceof Array &&
                                    function(t, e) {
                                        t.__proto__ = e;
                                    }) ||
                                function(t, e) {
                                    for (var o in e) {
                                        Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                                    }
                                })(t, e);
                        }),
                        function(t, e) {
                            function o() {
                                this.constructor = t;
                            }
                            _n39(t, e),
                                (t.prototype =
                                    null === e ?
                                    Object.create(e) :
                                    ((o.prototype = e.prototype), new o()));
                        });
                Object.defineProperty(o, '__esModule', {
                        value: !0
                    }),
                    (o.BattleWeapon = void 0);
                var r = t('AbsActor'),
                    a = t('MathUtils'),
                    s = t('SoundMrg'),
                    c = t('BattleUtils'),
                    l = t('HitEffect'),
                    u = t('PoolMrg'),
                    h = (function(t) {
                        function e(e, o) {
                            var n = t.call(this) || this;
                            return n.setType(r.ActorType.Effect), n.init(e, o), n;
                        }
                        return (
                            i(e, t),
                            (e.get = function(t) {
                                if (t) {
                                    var e = t.info;
                                    return u.PoolMrg.get('BattleWeapon-' + e.weapon);
                                }
                                return null;
                            }),
                            (e.prototype.init = function(t, e) {
                                (this._info = t.info),
                                (this._scale = t.scale),
                                (this._caster = t),
                                (this._target = e),
                                (this.entity.scale = Math.abs(
                                    t.entity.scale * t.model.scale
                                )),
                                (this.entity.zIndex = t.entity.zIndex + 1);
                                var o = t.getWeaponPoint();
                                (this.entity.x = o.x),
                                (this.entity.y = o.y),
                                (this._to = e.getHitPoint()),
                                t.type == r.ActorType.Soldier &&
                                    s.SoundMrg.playAudio('attack' + t.info.type),
                                    this.initParam(),
                                    this.loadWeapon(t.type, t.info),
                                    t.type == r.ActorType.Soldier &&
                                    (this.entity.angle = this._radian * a.default.Rad2Deg),
                                    (this._distance = a.default.distance2(
                                        this.entity.x,
                                        this.entity.y,
                                        this._to.x,
                                        this._to.y
                                    ));
                            }),
                            (e.prototype.loadWeapon = function() {
                                var t = 'Prefab/Effect/' + this._info.weapon;
                                (this.poolKey = 'BattleWeapon-' + this._info.weapon),
                                this.loadModel(t);
                            }),
                            (e.prototype.initParam = function() {
                                this._radian = Math.atan2(
                                    this._to.y - this.entity.y,
                                    this._to.x - this.entity.x
                                );
                            }),
                            (e.prototype.updateLocation = function(t) {
                                var e = a.default.to(
                                    this.entity.x,
                                    this.entity.y,
                                    this._radian,
                                    t
                                );
                                (this.entity.x = e.x), (this.entity.y = e.y);
                            }),
                            (e.prototype.onUpdate = function(e) {
                                t.prototype.onUpdate.call(this, e);
                                var o = c.default.WeaponSpeed * e;
                                this._distance > 0 ?
                                    (this.updateLocation(o), (this._distance -= o)) :
                                    this.hit();
                            }),
                            (e.prototype.hit = function() {
                                if (this.scene) {
                                    if (this._target.hp > 0 && !this._target.invincible) {
                                        var t = c.default.calculate(this._info, this._target.info);
                                        if (
                                            (this._target.hurt(t[0], 1 == t[1]), this._info.attackHit)
                                        ) {
                                            var e = l.HitEffect.get(this._info.attackHit);
                                            null == e && (e = new l.HitEffect(this._info.attackHit)),
                                                e.init(this._target, this._scale);
                                        }
                                        this._target.hp <= 0 && this._caster.kill(this._target);
                                    }
                                    (this._target = null),
                                    (this._caster = null),
                                    (this._info = null),
                                    this.scene ?
                                        this.scene.removeEffect(this) :
                                        (this.entity.parent = null),
                                        u.PoolMrg.put(this.poolKey, this);
                                } else this.entity.parent = null;
                            }),
                            (e.SPEED = 1200),
                            e
                        );
                    })(r.AbsActor);
                (o.BattleWeapon = h), console.log("end");
            module.exports =  e.exports;